﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PostProperty.aspx.cs" Inherits="FreeProperty.Views.Main.PostProperty" %>

<form id="frmContent" runat="server">
<script language="javascript">
    function CopyFromMyInformation() {
        var chkCopyMyInformation = document.getElementById('chkCopyMyInformation');

        var hdnContactName = document.getElementById('<%=hdnContactName.ClientID%>');
        var hdnContactEmail = document.getElementById('<%=hdnContactEmail.ClientID%>');
        var hdnContactPhone = document.getElementById('<%=hdnContactPhone.ClientID%>');

        var tbName = document.getElementById('<%=tbName.ClientID%>');
        var tbPhoneNo = document.getElementById('<%=tbPhoneNo.ClientID%>');
        var tbEmailId = document.getElementById('<%=tbEmailId.ClientID%>');

        if (chkCopyMyInformation.checked) {
            tbName.value = hdnContactName.value;
            tbEmailId.value = hdnContactEmail.value;
            tbPhoneNo.value = hdnContactPhone.value;
        }
        else {
            tbName.value = "";
            tbEmailId.value = "";
            tbPhoneNo.value = "";
        }

    }
    function CheckPrice() {
        var chkPriceUnknown = document.getElementById('chkPriceUnknown');
        if (chkPriceUnknown.checked) {
            var tbprice = document.getElementById('tbprice');
            tbprice.value = "";
        }
    }
    function OnChangePrice() {
        var chkPriceUnknown = document.getElementById('chkPriceUnknown');
        if (chkCopyMyInformation.checked) {
            chkCopyMyInformation.checked = false;
        }
    }

</script>
<h2>
    Post your requirements.</h2>
<div id="MainContainer">
    <asp:hiddenfield id="hdnMode" runat="server" />
    <asp:hiddenfield id="hdnPropertyId" runat="server" />
    <b>Search Instructions:</b> Post your requirements and others will find you. <span
        class="span">Property Type</span>
    <table style="width: 100%">
        <tr>
            <td class="colortxt">
                Property Type:
            </td>
            <td>
                <asp:dropdownlist id="ddlPropertyType" runat="server">               
                </asp:dropdownlist>
            </td>
            <td class="colortxt">
                Usage Type:
            </td>
            <td>
                <asp:dropdownlist id="ddlPurpose" runat="server">               
                </asp:dropdownlist>
            </td>
        </tr>
        <tr>
            <td class="colortxt">
                State:
            </td>
            <td>
                <asp:dropdownlist id="ddlState" onchange="javascript:return LoadDistrict('Views/Main/PostProperty.aspx')"
                    runat="server">               
                </asp:dropdownlist>
            </td>
            <td class="colortxt">
                City:
            </td>
            <td>
                <asp:dropdownlist id="ddlDistrict" runat="server">               
                </asp:dropdownlist>
            </td>
        </tr>
    </table>
    <span class="span">Specify address and details </span>
    <table style="width: 100%">
        <tr>
            <td style="width: 20%" class="colortxt">
                Price:
            </td>
            <td class="SmallTxt">
                <asp:textbox runat="server" maxlength="15" width="100px" id="tbprice" onblur="extractNumber(this,2,false);"
                    onkeyup="extractNumber(this,2,false);" onkeypress="return blockNonNumbers(this, event, true, false);"></asp:textbox>
                Rs.
                <asp:checkbox runat="server" id="chkPriceUnknown" onclick="CheckPrice();" width="20px"></asp:checkbox>
                Unknown?
            </td>
        </tr>
        <tr>
            <td class="colortxt">
                Location:
            </td>
            <td>
                <input type="text" runat="server" id="tbLocation" maxlength="20" />
            </td>
        </tr>
        <tr>
            <td class="colortxt">
                Address:
            </td>
            <td>
                <asp:textbox runat="server" id="tbAddress" maxlength="500" height="50px" width="250px"
                    textmode="MultiLine"></asp:textbox>
            </td>
        </tr>
        <tr>
            <td class="colortxt">
                Property Description:
            </td>
            <td class="colortxt">
                <asp:textbox runat="server" id="tbPropertyDetails" maxlength="1000" height="50px"
                    width="250px" textmode="MultiLine"></asp:textbox>
            </td>
        </tr>
    </table>
    <span class="span">Contact Info </span>
    <asp:hiddenfield id="hdnContactName" runat="server" />
    <asp:hiddenfield id="hdnContactEmail" runat="server" />
    <asp:hiddenfield id="hdnContactPhone" runat="server" />
    <table style="width: 100%">
        <tr>
            <td style="width: 20%">
                &nbsp;
            </td>
            <td class="SmallTxt">
                <input type="checkbox" id="chkCopyMyInformation" style="width: 20px" onclick="CopyFromMyInformation();" />
                Copy from My information.
            </td>
        </tr>
        <tr>
            <td class="colortxt">
                Name
            </td>
            <td>
                <input type="text" runat="server" id="tbName" maxlength="20" />
            </td>
        </tr>
        <tr>
            <td class="colortxt">
                Mobile/Phone No
            </td>
            <td>
                <input type="text" runat="server" id="tbPhoneNo" maxlength="50" />
            </td>
        </tr>
        <tr>
            <td class="colortxt">
                Email Id:
            </td>
            <td>
                <input type="text" runat="server" id="tbEmailId" maxlength="20" />
            </td>
        </tr>
        <tr>
            <td class="colortxt">
                Preferred Time
            </td>
            <td>
                <input type="text" runat="server" id="tbPreferredTime" maxlength="50" />
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:label id="lblError" cssclass="error" runat="server"></asp:label>
                <div class="error_message">
                    <asp:label runat="server" id="lblSpace" width="200px"></asp:label>
                </div>
            </td>
        </tr>
        <tr><td class="colortxt">
                &nbsp;
            </td>
            <td colspan="2">
                <input type="button" class="button" value="Save" onclick="javascript:return ValidateProperty('Views/Main/PostProperty.aspx')" />
            </td>
        </tr>
    </table>
</div>
</form>
<script type="text/javascript">

    $("#tbLocation").autocomplete("Views/Main/LocationSuggest.ashx?", {
        extraParams: {
            did: function () { return $("#ddlDistrict").attr('value'); }
        },
        delay: 200,
        selectOnly: true,
        cacheLength: 0,
        autoFill: true,
        matchSubset: true,
        minChars: 1
    });
    
</script>
